﻿using System;
using UnityEngine;

// Token: 0x02000070 RID: 112
public class GuideDrive_Scl : GuideDrive
{
	// Token: 0x0600038E RID: 910 RVA: 0x000169B8 File Offset: 0x00014BB8
	private void Start()
	{
		base.Init();
	}

	// Token: 0x0600038F RID: 911 RVA: 0x000169C0 File Offset: 0x00014BC0
	private void Update()
	{
		if (this.onMove)
		{
			Vector3 vector = Input.mousePosition - this.movePrevPos;
			this.movePrevPos = Input.mousePosition;
			if (this.moveType == GuideDrive_Scl.MoveType.XYZ)
			{
				float num = (vector.x + vector.y) * this.speed;
				vector = new Vector3(num, num, num);
				this.manager.Target.transform.localScale += vector;
			}
			else
			{
				vector = Camera.main.transform.rotation * vector * this.speed;
				if ((this.moveType & GuideDrive_Scl.MoveType.X) == (GuideDrive_Scl.MoveType)0)
				{
					vector.x = 0f;
				}
				if ((this.moveType & GuideDrive_Scl.MoveType.Y) == (GuideDrive_Scl.MoveType)0)
				{
					vector.y = 0f;
				}
				if ((this.moveType & GuideDrive_Scl.MoveType.Z) == (GuideDrive_Scl.MoveType)0)
				{
					vector.z = 0f;
				}
				this.manager.DriveMoveScale(vector);
			}
			if (Input.GetMouseButtonUp(0))
			{
				this.OnMoveEnd();
				this.manager.OnMoveEnd(this);
			}
		}
	}

	// Token: 0x06000390 RID: 912 RVA: 0x00016ADC File Offset: 0x00014CDC
	private Vector3 PlanePos(Vector3 screenPos)
	{
		Vector3 inNormal = base.transform.rotation * Vector3.up;
		Plane plane = new Plane(inNormal, base.transform.position);
		Ray ray = Camera.main.ScreenPointToRay(screenPos);
		float distance = 0f;
		if (plane.Raycast(ray, out distance))
		{
			return ray.GetPoint(distance);
		}
		return this.manager.transform.position;
	}

	// Token: 0x04000321 RID: 801
	[SerializeField]
	private GuideDrive_Scl.MoveType moveType;

	// Token: 0x04000322 RID: 802
	[SerializeField]
	private float speed = 0.001f;

	// Token: 0x02000071 RID: 113
	public enum MoveType
	{
		// Token: 0x04000324 RID: 804
		X = 1,
		// Token: 0x04000325 RID: 805
		Y,
		// Token: 0x04000326 RID: 806
		Z = 4,
		// Token: 0x04000327 RID: 807
		XYZ = 7
	}
}
